home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Leser 19
/
Amiga Plus Leser CD 19.iso
/
Online
/
AmigaTalk
/
intuition
/
IFFConstants.st
< prev
next >
Wrap
Text File
|
2002-01-26
|
9KB
|
215 lines
" ------------------------------------------------------------------- "
" IFFConstants Class is a Singleton class that allows the user "
" to reference IFF flags, tags, etc, which are used to process IFF "
" files. "
""
" The User does NOT need to create one of these, since DataTypeSystem "
" Class will instantiate the only needed instance of this Class. See "
" the DataTypeSystem.st source file for the method(s) that help the "
" User with this Class. "
""
" ALL singleton classes MUST contain the following: "
""
" the methods: isSingleton AND privateSetup AND "
" uniqueInstance Class instance variable. "
" ------------------------------------------------------------------- "
Class IFFConstants :Dictionary ! uniqueInstance !
[
isSingleton
^ true
|
privateNew ! newinstance !
newinstance <- super new.
^ newinstance
|
new
^ self privateSetup
|
privateSetup
(uniqueInstance isNil)
ifTrue: [uniqueInstance <- self privateNew.
self privateInitializeDictionary.
].
^ self
|
privateInitializeDictionary
" Since more entries might be added, this stuff is NOT in a Block."
" bit definitions for 'iff_Flags' field: "
self at: #IFFF_READ put: 0. " read mode - default "
self at: #IFFF_WRITE put: 1. " write mode "
self at: #IFFF_RWBITS put: 1. " (IFFF_READ | IFFF_WRITE) read/write bits "
self at: #IFFF_FSEEK put: 2. " forward seek only "
self at: #IFFF_RSEEK put: 4. " random seek "
self at: #IFFF_RESERVED put: 16rFFFF0000. " Don't touch these bits "
" IFF return codes. Most functions return either zero for success or
* one of these codes. The exceptions are the read/write functions which
* return positive values for number of bytes or records read or written,
* or a negative error code. Some of these codes are not errors per se,
* but valid conditions such as EOF or EOC (End of Chunk). There is a
* method in IFF class that will translate these numbers into a human-
* readable (not necessarily understandable) string. These are here for
* reference only & you probably won't ever use them in your code.
"
self at: #IFFERR_EOF put: -1. " Reached logical end of file "
self at: #IFFERR_EOC put: -2. " About to leave context "
self at: #IFFERR_NOSCOPE put: -3. " No valid scope for property "
self at: #IFFERR_NOMEM put: -4. " Internal memory alloc failed "
self at: #IFFERR_READ put: -5. " Stream read error "
self at: #IFFERR_WRITE put: -6. " Stream write error "
self at: #IFFERR_SEEK put: -7. " Stream seek error "
self at: #IFFERR_MANGLED put: -8. " Data in file is corrupt "
self at: #IFFERR_SYNTAX put: -9. " IFF syntax error "
self at: #IFFERR_NOTIFF put: -10. " Not an IFF file "
self at: #IFFERR_NOHOOK put: -11. " No call-back hook provided "
self at: #IFF_RETURN2CLIENT put: -12. " Client handler normal return "
" Control modes for parseIFF method: "
self at: #IFFPARSE_SCAN put: 0.
self at: #IFFPARSE_STEP put: 1.
self at: #IFFPARSE_RAWSTEP put: 2.
" Control modes for storeLocalItem method: "
self at: #IFFSLI_ROOT put: 1. " Store in default context "
self at: #IFFSLI_TOP put: 2. " Store in current context "
self at: #IFFSLI_PROP put: 3. " Store in topmost FORM or LIST "
" Magic value for writing functions. If you pass this value in as a size
* to pushChunk: when writing a file, the parser will figure out the
* size of the chunk for you. If you know the size, is it better to
* provide as it makes things faster.
"
self at: #IFFSIZE_UNKNOWN put: -1.
" Possible call-back command values "
self at: #IFFCMD_INIT put: 0. " Prepare the stream for a session "
self at: #IFFCMD_CLEANUP put: 1. " Terminate stream session "
self at: #IFFCMD_READ put: 2. " Read bytes from stream "
self at: #IFFCMD_WRITE put: 3. " Write bytes to stream "
self at: #IFFCMD_SEEK put: 4. " Seek on stream "
self at: #IFFCMD_ENTRY put: 5. " You just entered a new context "
self at: #IFFCMD_EXIT put: 6. " You're about to leave a context "
self at: #IFFCMD_PURGELCI put: 7. " Purge a LocalContextItem "
]
" ------------------------------------------------------------------- "
" IDNumbers Class is a Singleton class that allows the user "
" to reference IDNumbers which denote IFF Chunk headers. "
""
" The User does NOT need to create one of these, since DataTypeSystem "
" Class will instantiate the only needed instance of this Class. See "
" the DataTypeSystem.st source file for the method(s) that help the "
" User with this Class. "
""
" ALL singleton classes MUST contain the following: "
""
" the methods: isSingleton AND privateSetup AND "
" uniqueInstance Class instance variable. "
" ------------------------------------------------------------------- "
Class IDNumbers :Dictionary ! uniqueInstance !
[
isSingleton
^ true
|
privateNew ! newinstance !
newinstance <- super new.
^ newinstance
|
new
^ self privateSetup
|
privateSetup
(uniqueInstance isNil)
ifTrue: [uniqueInstance <- self privateNew.
self privateInitializeDictionary.
].
^ self
|
privateInitializeDictionary
" Since more entries might be added, this stuff is NOT in a Block."
"Used by multiple types:"
self at: #ID_BODY put: 16r424F4459. "BODY"
"Animation IDs:"
self at: #ID_ANIM put: 16r414E494D. "ANIM"
self at: #ID_ANHD put: 16r414E4844. "ANHD"
self at: #ID_DLTA put: 16r444C5441. "DLTA"
"DataType IDs:"
self at: #ID_DTYP put: 16r44545950. "DTYP"
self at: #ID_DTHD put: 16r44544844. "DTHD"
"System file, such as; directory, executable, library,
* device, font, etc.
"
self at: #GID_SYSTEM put: 16r73797374. "syst"
"Formatted or unformatted text:"
self at: #GID_TEXT put: 16r74657874. "text"
"Formatted text with graphics or other DataTypes:"
self at: #GID_DOCUMENT put: 16r646F6375. "docu"
"Sound:"
self at: #GID_SOUND put: 16r736F756E. "soun"
"Musical instruments used for musical scores:"
self at: #GID_INSTRUMENT put: 16r696E7374. "inst"
"Musical score:"
self at: #GID_MUSIC put: 16r6D757369. "musi"
"Still picture:"
self at: #GID_PICTURE put: 16r70696374. "pict"
"Animated picture:"
self at: #GID_ANIMATION put: 16r616E696D. "anim"
"Animation with audio track:"
self at: #GID_MOVIE put: 16r6D6F7669. "movi"
"A code chunk contains an embedded executable that
* can be loaded with InternalLoadSeg:
"
self at: #ID_CODE put: 16r44544344. "DTCD"
self at: #ID_TOOL put: 16r4454544C. "DTTL"
self at: #ID_TAGS put: 16r44545447. "DTTG"
self at: #ID_NAME put: 16r4E414D45. "NAME"
"For Picture DataTypes:"
"IFF types that may be in pictures:"
self at: #ID_ILBM put: 16r494C424D. "ILBM"
self at: #ID_BMHD put: 16r424D4844. "BMHD"
self at: #ID_CMAP put: 16r434D4150. "CMAP"
self at: #ID_CRNG put: 16r43524E47. "CRNG"
self at: #ID_GRAB put: 16r47524142. "GRAB"
self at: #ID_SPRT put: 16r53505254. "SPRT"
self at: #ID_DEST put: 16r44455354. "DEST"
self at: #ID_CAMG put: 16r43414D47. "CAMG"
"For Text datatypes:"
"IFF types that may be text:"
self at: #ID_FTXT put: 16r46545854. "FTXT"
self at: #ID_CHRS put: 16r43485253. "CHRS"
"For Sound DataTypes:"
self at: #ID_8SVX put: 16r38535658. "8SVX"
self at: #ID_VHDR put: 16r56484452. "VHDR"
self at: #ID_CHAN put: 16r4348414E. "CHAN"
self at: #ID_SMUS put: 16r534D5553. "SMUS"
]